package com.cwz.api.remote;

import com.cwz.api.entity.SysUser;
import com.cwz.api.factory.RemoteUserFallbackFactory;
import com.cwz.api.model.LoginUser;
import com.cwz.core.constant.SecurityConstants;
import com.cwz.core.constant.ServiceNameConstants;
import com.cwz.core.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @program: w-demo
 * @description: 用户服务 feign
 * @author: Wen
 **/
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {
	/**
	 * @Description: 通过用户名查询用户信息
	 * @Author: Wen
	 * @param username: 	用户名
	 * @param source:  		请求来源
	 * @return: com.cwz.core.result.R<com.cwz.api.model.LoginUser>
	 **/
	@GetMapping("/user/info/{username}")
	public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

	/**
	 * @Description: 注册用户信息
	 * @Author: Wen
	 * @param sysUser: 	用户信息
	 * @param source:  	请求来源
	 * @return: com.cwz.core.result.R<java.lang.Boolean>
	 **/
	@PostMapping("/user/register")
	public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
